package sk.mka.phd.googleagent.ngram;

import sk.mka.phd.googleagent.config.MavenSingletonConfig;
import sk.mka.utils.tools.filesystem.FileUtils;

/**
 *
 * @author katrami
 * @date Dec 10, 2010
 */
public class AbstractNgramAgent extends AbstactAgent {

    private final String CONFIG_FILENAME = "target/classes/googleagent-statistics.properties";
    protected MavenSingletonConfig config = MavenSingletonConfig.getInstance(CONFIG_FILENAME);
    public String refusedWordsFromDictionary;
    public String dictionaryOutput;
    public String dictionaryInput;
    public String sleepTime;
    public String ngramOutputFileName;
    public int ngram;
    public boolean writeRefusedWordsFromDictionary;

    public AbstractNgramAgent() {
        sleepTime = config.getEnviroment().getProperty("sleepTime");
        ngram = Integer.valueOf(config.getEnviroment().getProperty("ngram"));
        dictionaryInput = config.getEnviroment().getProperty("dictionaryInput");
        dictionaryOutput = config.getEnviroment().getProperty("dictionaryOutput");
        String x = config.getEnviroment().getProperty("writeRefusedWordsFromDictionary");
        writeRefusedWordsFromDictionary = Boolean.valueOf(x);
        this.ngramOutputFileName = config.getEnviroment().getProperty("ngramOutputFileName");
        // remove ngram output file
        FileUtils.delete(ngramOutputFileName);
        refusedWordsFromDictionary = config.getEnviroment().getProperty("refusedWordsFromDictionary");
        FileUtils.delete(refusedWordsFromDictionary);
    }
}
